import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
//导入node.js中的path
import path from 'path'

// https://vitejs.dev/config/
export default defineConfig({
  plugins: [vue()],

  resolve: {
		alias: {   //配置路径别名
			'@': path.resolve(__dirname, 'src'),
			'@icons': path.resolve(__dirname, 'src/icons'),
		}
	},

	server: {
		proxy: {
		  '/api': {
			target: ' http://localhost:5173/', // 凡是遇到 /api 路径的请求，都映射到 target 属性
			changeOrigin: true,
			rewrite: path => path.replace(/^\/api/, '') // 重写 api 为 空，就是去掉它
		  }
		}
	},
	// tailwind CSS 优化配置
	optimizeDeps: {
		include: ['@fortawesome/fontawesome-free'],
	},
})
